//
//  SAPaymentCell.m
//  saasRetail
//
//  Created by 黄志刚 on 2022/4/24.
//

#import "SAPaymentCell.h"
#import "UILabel+NSMutableAttributedString.h"

@interface SAPaymentCell ()

@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UILabel *contentLab;
@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UIImageView *imageV2;

@end

@implementation SAPaymentCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

-(void)refreshWithTitle:(NSString *)title AndContent:(NSString *)content {
    self.titleLab.text = title;
    [self.titleLab setAttributedStringWithSubString:@"（调配单据不显示单价及金额）" color:kLightgGrayColor font:kFont(14)];

    if ([content isEqualToString:@"noSettlement"]) {
        self.imageV.hidden = YES;
        self.contentLab.text = @"";
        self.imageV2.hidden = NO;
    }else if ([content isEqualToString:@"settlement"]) {
        self.imageV.hidden = YES;
        self.contentLab.text = @"";
        self.imageV2.hidden = YES;
    }else {
        self.imageV.hidden = NO;
        self.imageV2.hidden = YES;
        self.contentLab.text = content;
    }
    
}

-(void)initUI {
    UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScaleNum(45))];
    whiteView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:whiteView];
    for (int i = 0; i < 3; i++) {
        UILabel *titleLab = [[UILabel alloc] init];
        titleLab.font = kFont(15);
        titleLab.textColor = kBlackColor;
        [whiteView addSubview:titleLab];
        if (i == 0) {
            titleLab.frame = CGRectMake(kScaleNum(30), 0, kScaleNum(250), kScaleNum(44));
            self.titleLab = titleLab;
            titleLab.textAlignment = NSTextAlignmentLeft;
        }else if (i == 1) {
            titleLab.frame = CGRectMake(kScreenWidth - kScaleNum(130), 0, kScaleNum(80), kScaleNum(44));
            self.contentLab = titleLab;
            titleLab.textColor = kLightgGrayColor;
            titleLab.textAlignment = NSTextAlignmentRight;
        }
    }
    
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - kScaleNum(40), kScaleNum(12), kScaleNum(20), kScaleNum(20))];
    imageV.image = [UIImage imageNamed:@"Allocate_arrow"];
    [self.contentView addSubview:imageV];
    self.imageV = imageV;
    
    UIImageView *imageV2 = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - kScaleNum(65), kScaleNum(12.5), kScaleNum(25), kScaleNum(20))];
    imageV2.image = [UIImage imageNamed:@"bule_check"];
    [self.contentView addSubview:imageV2];
    self.imageV2 = imageV2;
    
//    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, kScaleNum(44), kScreenWidth, kScaleNum(1))];
//    line.backgroundColor = kLineColor;
//    [self.contentView addSubview:line];
    
    
}

@end
